\(\int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx\) [9]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 26 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {\text {arctanh}(\cos (x))}{a}-\frac {2 \cot (x)}{a}+\frac {\cot (x)}{a+a \sin (x)} \]

[Out]

arctanh(cos(x))/a-2*cot(x)/a+cot(x)/(a+a*sin(x))

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.385, Rules used = {2847, 2827, 3852, 8, 3855} \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {\text {arctanh}(\cos (x))}{a}-\frac {2 \cot (x)}{a}+\frac {\cot (x)}{a \sin (x)+a} \]

[In]

Int[Csc[x]^2/(a + a*Sin[x]),x]

[Out]

ArcTanh[Cos[x]]/a - (2*Cot[x])/a + Cot[x]/(a + a*Sin[x])

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2827

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*S
in[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]

Rule 2847

Int[((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b
^2)*Cos[e + f*x]*((c + d*Sin[e + f*x])^(n + 1)/(a*f*(b*c - a*d)*(a + b*Sin[e + f*x]))), x] + Dist[d/(a*(b*c -
a*d)), Int[(c + d*Sin[e + f*x])^n*(a*n - b*(n + 1)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && Ne
Q[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[n, 0] && (IntegerQ[2*n] || EqQ[c, 0])

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\cot (x)}{a+a \sin (x)}-\frac {\int \csc ^2(x) (-2 a+a \sin (x)) \, dx}{a^2} \\ & = \frac {\cot (x)}{a+a \sin (x)}-\frac {\int \csc (x) \, dx}{a}+\frac {2 \int \csc ^2(x) \, dx}{a} \\ & = \frac {\text {arctanh}(\cos (x))}{a}+\frac {\cot (x)}{a+a \sin (x)}-\frac {2 \text {Subst}(\int 1 \, dx,x,\cot (x))}{a} \\ & = \frac {\text {arctanh}(\cos (x))}{a}-\frac {2 \cot (x)}{a}+\frac {\cot (x)}{a+a \sin (x)} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(63\) vs. \(2(26)=52\).

Time = 0.19 (sec) , antiderivative size = 63, normalized size of antiderivative = 2.42 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {-\cot \left (\frac {x}{2}\right )+2 \log \left (\cos \left (\frac {x}{2}\right )\right )-2 \log \left (\sin \left (\frac {x}{2}\right )\right )+\frac {4 \sin \left (\frac {x}{2}\right )}{\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )}+\tan \left (\frac {x}{2}\right )}{2 a} \]

[In]

Integrate[Csc[x]^2/(a + a*Sin[x]),x]

[Out]

(-Cot[x/2] + 2*Log[Cos[x/2]] - 2*Log[Sin[x/2]] + (4*Sin[x/2])/(Cos[x/2] + Sin[x/2]) + Tan[x/2])/(2*a)

Maple [A] (verified)

Time = 0.44 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.38

method result size
default \(\frac {\tan \left (\frac {x}{2}\right )-\frac {1}{\tan \left (\frac {x}{2}\right )}-2 \ln \left (\tan \left (\frac {x}{2}\right )\right )-\frac {4}{\tan \left (\frac {x}{2}\right )+1}}{2 a}\) \(36\)
parallelrisch \(\frac {\left (-2 \cos \left (2 x \right )+2\right ) \ln \left (\csc \left (x \right )-\cot \left (x \right )\right )+\left (4 \tan \left (x \right )-3\right ) \cos \left (2 x \right )+4 \tan \left (x \right ) \sin \left (x \right )+3}{2 a \left (-1+\cos \left (2 x \right )\right )}\) \(50\)
norman \(\frac {-\frac {3 \tan \left (\frac {x}{2}\right )}{a}-\frac {1}{2 a}+\frac {\tan ^{3}\left (\frac {x}{2}\right )}{2 a}}{\tan \left (\frac {x}{2}\right ) \left (\tan \left (\frac {x}{2}\right )+1\right )}-\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )}{a}\) \(53\)
risch \(-\frac {2 \left (-2+i {\mathrm e}^{i x}+{\mathrm e}^{2 i x}\right )}{\left ({\mathrm e}^{2 i x}-1\right ) \left ({\mathrm e}^{i x}+i\right ) a}+\frac {\ln \left ({\mathrm e}^{i x}+1\right )}{a}-\frac {\ln \left ({\mathrm e}^{i x}-1\right )}{a}\) \(66\)

[In]

int(csc(x)^2/(a+a*sin(x)),x,method=_RETURNVERBOSE)

[Out]

1/2/a*(tan(1/2*x)-1/tan(1/2*x)-2*ln(tan(1/2*x))-4/(tan(1/2*x)+1))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 91 vs. \(2 (26) = 52\).

Time = 0.31 (sec) , antiderivative size = 91, normalized size of antiderivative = 3.50 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {4 \, \cos \left (x\right )^{2} + {\left (\cos \left (x\right )^{2} - {\left (\cos \left (x\right ) + 1\right )} \sin \left (x\right ) - 1\right )} \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) - {\left (\cos \left (x\right )^{2} - {\left (\cos \left (x\right ) + 1\right )} \sin \left (x\right ) - 1\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) + 2 \, {\left (2 \, \cos \left (x\right ) + 1\right )} \sin \left (x\right ) + 2 \, \cos \left (x\right ) - 2}{2 \, {\left (a \cos \left (x\right )^{2} - {\left (a \cos \left (x\right ) + a\right )} \sin \left (x\right ) - a\right )}} \]

[In]

integrate(csc(x)^2/(a+a*sin(x)),x, algorithm="fricas")

[Out]

1/2*(4*cos(x)^2 + (cos(x)^2 - (cos(x) + 1)*sin(x) - 1)*log(1/2*cos(x) + 1/2) - (cos(x)^2 - (cos(x) + 1)*sin(x)
 - 1)*log(-1/2*cos(x) + 1/2) + 2*(2*cos(x) + 1)*sin(x) + 2*cos(x) - 2)/(a*cos(x)^2 - (a*cos(x) + a)*sin(x) - a
)

Sympy [F]

\[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {\int \frac {\csc ^{2}{\left (x \right )}}{\sin {\left (x \right )} + 1}\, dx}{a} \]

[In]

integrate(csc(x)**2/(a+a*sin(x)),x)

[Out]

Integral(csc(x)**2/(sin(x) + 1), x)/a

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (26) = 52\).

Time = 0.21 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.62 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=-\frac {\frac {5 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} + 1}{2 \, {\left (\frac {a \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}} - \frac {\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a} + \frac {\sin \left (x\right )}{2 \, a {\left (\cos \left (x\right ) + 1\right )}} \]

[In]

integrate(csc(x)^2/(a+a*sin(x)),x, algorithm="maxima")

[Out]

-1/2*(5*sin(x)/(cos(x) + 1) + 1)/(a*sin(x)/(cos(x) + 1) + a*sin(x)^2/(cos(x) + 1)^2) - log(sin(x)/(cos(x) + 1)
)/a + 1/2*sin(x)/(a*(cos(x) + 1))

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 53 vs. \(2 (26) = 52\).

Time = 0.34 (sec) , antiderivative size = 53, normalized size of antiderivative = 2.04 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=-\frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right )}{a} + \frac {\tan \left (\frac {1}{2} \, x\right )}{2 \, a} + \frac {\tan \left (\frac {1}{2} \, x\right )^{2} - 4 \, \tan \left (\frac {1}{2} \, x\right ) - 1}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{2} + \tan \left (\frac {1}{2} \, x\right )\right )} a} \]

[In]

integrate(csc(x)^2/(a+a*sin(x)),x, algorithm="giac")

[Out]

-log(abs(tan(1/2*x)))/a + 1/2*tan(1/2*x)/a + 1/2*(tan(1/2*x)^2 - 4*tan(1/2*x) - 1)/((tan(1/2*x)^2 + tan(1/2*x)
)*a)

Mupad [B] (verification not implemented)

Time = 6.61 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.88 \[ \int \frac {\csc ^2(x)}{a+a \sin (x)} \, dx=\frac {\mathrm {tan}\left (\frac {x}{2}\right )}{2\,a}-\frac {5\,\mathrm {tan}\left (\frac {x}{2}\right )+1}{2\,a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,a\,\mathrm {tan}\left (\frac {x}{2}\right )}-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{a} \]

[In]

int(1/(sin(x)^2*(a + a*sin(x))),x)

[Out]

tan(x/2)/(2*a) - (5*tan(x/2) + 1)/(2*a*tan(x/2) + 2*a*tan(x/2)^2) - log(tan(x/2))/a